import numpy as np
import pandas as pd


def var_code(data: pd.DataFrame):
    # the column with more than 10 values will be considered separately
    multiple_category_field = []
    for column, value in data.items():
        value_num = len(value.unique())
        if 2 <= value_num < 10:
            if column != 'product_num':
                multiple_category_field.append(column)
        else:
            continue
    return pd.get_dummies(data, columns=multiple_category_field, dtype=int)
